<?php

class GridHelper extends AppHelper
{
	//var $name = 'Eav';
	var $helpers = array('Form');
	
	function header()
	{
		
	}
	
	function rows($records)
	{
		
	}
	
	function footer()
	{
		
	}
	
	function displayValue($modelObj, $record, $field)
	{
		$value = $record[$modelObj->alias][$field];
		if(isset($modelObj->fieldOptions[$field]) && is_string($value))
		{
			$value = array($value);
		}
		if(is_array($value))
		{
			$stringVal = '';
			foreach($value as $val)
			{
				$stringVal .= $modelObj->fieldOptions[$field][$val].', ';
			}
			$stringVal = substr($stringVal, 0, -2);
			$value = $stringVal;
		}
		return $value;
	}
	
	function searchForm($modelObj)
	{
		$content = $this->Form->create('Jerk', array('url'=>'/eav/records/index'));
		//$content .= $this->Form->inputs();
		
		foreach($modelObj->searchFields as $field)
		{
			$content .= $this->Form->input($field);
		}
		$content .= $this->Form->end(__('Filter Results'));
		return $content;
	}
	

}


?>
